package com.lanou.dao;
import com.lanou.domain.CrmDepartment;
import com.lanou.domain.CrmPost;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import java.util.List;

/**
 * Created by lanouhn on 17/9/29.
 */

public class PostDaoImpl extends HibernateDaoSupport implements PostDao{

    @Override
    public List<CrmPost> findPost(String depId) {
        System.out.println("dao..........");
        CrmDepartment department =this.getHibernateTemplate().get(CrmDepartment.class,depId);
        System.out.println(department.getDepName());

        List<CrmPost> post = (List<CrmPost>) this.getHibernateTemplate().find("from CrmPost where department=?",department );
        System.out.println(post);
        return post;

    }
}
